<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课程管理</title>
<script type="text/javascript">
	function del(id) {
		if(confirm("是否要删除这条记录？")){
			window.location="course?method=delete&id="+id;
		}	
	}
	function add() {
		window.location="course?method=add"
	}
	function update(id) {
		window.location="course?method=update&id="+id;
	}
	function fandeng() {
		window.location="login.jsp"
	}	
	function fanzhu() {
		window.location="main?method=main"
	}	
</script>
</head>
<body>
<div class="aaa">
<h3>课程管理</h3>
<button onclick="add()" id="button" class="push_button red">新增</button>
<table border="1">
	<tr> 	
		<th>序号</th>
		<th>课程名称</th>
		<th>课时</th>
		<th colspan="2">操作</th>
	</tr>
	<c:forEach items="${list}" var="cou">
		<tr>
			<td>${cou.id }</td>
			<td>${cou.name }</td>
			<td>${cou.classHour}</td>
			<td><button type="button" onclick="update(${cou.id})" id="button" class="push_button red">修改</button></td>
			<td><button onclick="javascript:del(${cou.id})" id="button" class="push_button blue">删除</button></td>
		</tr>
</c:forEach>
</table>
</div>
<div class="bbb">
	<button onclick="fandeng()" class="btn">返回登录页面</button>
	<button onclick="fanzhu()" class="btn">返回主页面</button>
</div>
	</body>
</html>